package redis

import (
	"context"
	"fmt"
)

const GoodsStock = "good_stock:user_id_"

func StockGoods(goodId int64, goodStock int64) {
	key := GoodsStock + fmt.Sprintf("%d", goodId)
	for i := 0; i < int(goodStock); i++ {
		Rdb.LPush(context.Background(), key, goodId)
	}
}
func GetGoodStock(goodId int64) int64 {
	key := GoodsStock + fmt.Sprintf("%d", goodId)
	return Rdb.LLen(context.Background(), key).Val()
}
